﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Web;

namespace MvcSystemsCommander.Extensions.Security
{
    public enum MSCIdentityAuthenticationType
    {
        ApplicationAuthentication,
        WindowsAuthentication
    }

    public class MSCIdentity : IIdentity
    {
        private string _IdentityUsername;
        private MSCIdentityAuthenticationType _IdentityAuthType;

        public MSCIdentity(string nUsername, MSCIdentityAuthenticationType nType)
        {
            this._IdentityUsername = nUsername;
            this._IdentityAuthType = nType;
        }

        public string AuthenticationType
        {
            get { return _IdentityAuthType.ToString(); }
        }

        public bool IsAuthenticated
        {
            get { return (this._IdentityUsername != null); }
        }

        public string Name
        {
            get { return this._IdentityUsername.ToString(); }
        }
    }

    public static class MSCIdentityFactory
    {
        public static MSCIdentity MSCAppAuthIdentity(string nUsername)
        {
            return new MSCIdentity(nUsername, MSCIdentityAuthenticationType.ApplicationAuthentication);
        }

        public static MSCIdentity MSCWindowsAuthIdentity(string nUsername)
        {
            return new MSCIdentity(nUsername, MSCIdentityAuthenticationType.WindowsAuthentication);
        }
    }
}